Skip to content

Conversation

@JarmouniA
Copy link
Contributor

@JarmouniA JarmouniA commented Oct 27, 2025

Fix how Doxygen special command \retval is used in APIs doc text.

\retval: Starts a description for a function's return value with name <return value>, which needs to be attached and to not be a word that is part of the sentence, and each return value should have its own \retval.
Otherwise \retval is replaced with \return.

See https://www.doxygen.nl/manual/commands.html#cmdreturn
https://www.doxygen.nl/manual/commands.html#cmdretval
https://docs.rtems.org/docs/main/eng/coding-doxygen.html

Doc preview https://builds.zephyrproject.io/zephyr/pr/98324/docs/doxygen/html/topics.html

Fix how Doxygen special commands \retval & \return are used in doc text.
\retval: Starts a description for a function's return value with name
<return value>, which needs to be attached and to not be a word that is
part of the sentence, and each return val should have its own \retval.
Otherwise \retval is replaced with \return.

Signed-off-by: Abderrahmane JARMOUNI <[email protected]>
Fix how Doxygen special commands \retval & \return are used in doc text.
\retval: Starts a description for a function's return value with name
<return value>, which needs to be attached and to not be a word that is
part of the sentence, and each return val should have its own \retval.
Otherwise \retval is replaced with \return.

Signed-off-by: Abderrahmane JARMOUNI <[email protected]>
Fix how Doxygen special commands \retval & \return are used in doc text.
\retval: Starts a description for a function's return value with name
<return value>, which needs to be attached and to not be a word that is
part of the sentence, and each return val should have its own \retval.
Otherwise \retval is replaced with \return.

Signed-off-by: Abderrahmane JARMOUNI <[email protected]>
Fix how Doxygen special commands \retval & \return are used in doc text.
\retval: Starts a description for a function's return value with name
<return value>, which needs to be attached and to not a word that is
part of the sentence, and each return val should have its own \retval.
Otherwise \retval is replaced with \return.

Signed-off-by: Abderrahmane JARMOUNI <[email protected]>
Fix how Doxygen special commands \retval & \return are used in doc text.
\retval: Starts a description for a function's return value with name
<return value>, which needs to be attached and to not a word that is
part of the sentence, and each return val should have its own \retval.
Otherwise \retval is replaced with \return.

Signed-off-by: Abderrahmane JARMOUNI <[email protected]>
Fix how Doxygen special commands \retval & \return are used in doc text.
\retval: Starts a description for a function's return value with name
<return value>, which needs to be attached and to not be a word that is
part of the sentence, and each return val should have its own \retval.
Otherwise \retval is replaced with \return.

Signed-off-by: Abderrahmane JARMOUNI <[email protected]>
Fix how Doxygen special commands \retval & \return are used in doc text.
\retval: Starts a description for a function's return value with name
<return value>, which needs to be attached and to not be a word that is
part of the sentence, and each return val should have its own \retval.
Otherwise \retval is replaced with \return.

Signed-off-by: Abderrahmane JARMOUNI <[email protected]>
@sonarqubecloud
Copy link

Comment on lines +87 to +88
* @retval true if the two addresses are equal
* @retval false otherwise
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are already touching so many @retvals, consider if it makes sense to fully fix some of the issues with @retval in the documentation: #65974

E.g. these need to be

Suggested change
* @retval true if the two addresses are equal
* @retval false otherwise
* @retval true The two addresses are equal
* @retval false The two addresses are not equal

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a 1st attempt in #97876, but closed it since the changes seemed to be somewhat controversial & it was going to take considerable time to address each case individually.

@JarmouniA JarmouniA added this to the v4.3.0 milestone Nov 4, 2025
Copy link
Contributor

@Thalley Thalley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not objecting to the changes in this PR; it's probably an overall improvement and it certainly fixes a lot of formatting issues.

However, some of the changes from retval => return does seem like a step in the wrong direction, and a proper fix for the documentation of return values would have been better. Chances are that some of the changes here would have to be reverted back to retval, or that some of the retvalsshould be removed and the text moved to thereturn`.

Comment on lines +278 to 280
* @return Number of bytes copied on success
* @retval ISOTP_RECV_TIMEOUT when "timeout" timed out
* @retval ISOTP_N_* on error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit curious to use both @return and @retval, but I guess it works:

Image

Although it may be better to have something like

Image (from e.g. https://man7.org/linux/man-pages/man2/send.2.html)

i.e. making it clear that it either returns a value, or a set of errors. I don't see anything in doxygen that supports this though - @kartben thoughts?

Copy link
Contributor

@kartben kartben Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit curious to use both @return and @RetVal, but I guess it works

Yeah the combination of @return and @retval probably looks "wrong" at first sight, but I do think it's actually great. See here.

i.e. making it clear that it either returns a value, or a set of errors. I don't see anything in doxygen that supports this though - @kartben thoughts?

Yeah probably not supported. I think "Returns" vs. "Returns values" is already not so bad though?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "Returns" vs. "Returns values" is already not so bad though?

I don't think it is bad, I just think "Return Value" and "Errors" is better :)

Comment on lines 237 to +240
* @retval 0 if successful.
* @retval -EINVAL if any provided cellular network configuration is invalid or unsupported.
* @retval -ENOTSUP if API is not supported by cellular network device.
* @retval Negative errno-code otherwise.
* @retval <0 Negative errno-code otherwise.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also a bit weird where only a subset of the error codes are defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants